<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>搜索结果 - 智能租房</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <style>
        body {
            background: #f8f9fa;
            padding: 20px;
        }
        .search-list-container {
            max-width: 1200px;
            margin: 0 auto;
            background: white;
            border-radius: 10px;
            box-shadow: 0 0 20px rgba(0,0,0,0.1);
            padding: 30px;
        }
        .collection-line {
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            padding: 20px;
            margin-bottom: 20px;
            transition: all 0.3s ease;
        }
        .collection-line:hover {
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
            transform: translateY(-2px);
        }
        .img-box {
            width: 100%;
            height: 200px;
            object-fit: cover;
            border-radius: 6px;
        }
        .title {
            font-size: 1.2em;
            font-weight: bold;
            margin-bottom: 10px;
        }
        .title a {
            color: #2c3e50;
            text-decoration: none;
        }
        .title a:hover {
            color: #3498db;
        }
        .attribute-text {
            color: #7f8c8d;
            font-weight: bold;
        }
        .info-text {
            color: #2c3e50;
        }
        .info-more {
            text-align: right;
        }
        .price-text {
            color: #e74c3c;
            font-size: 1.5em;
            font-weight: bold;
            display: block;
            margin-bottom: 10px;
        }
        .back-button {
            margin-bottom: 20px;
        }
        .search-result-header {
            margin-bottom: 30px;
            padding-bottom: 15px;
            border-bottom: 2px solid #3498db;
        }
    </style>
</head>
<body>
    <div class="search-list-container">
        <a href="/" class="btn btn-outline-primary back-button">
            <i class="fas fa-arrow-left"></i> 返回首页
        </a>

        <div class="search-result-header">
            <h2><i class="fas fa-search"></i> 搜索结果</h2>
            <p class="text-muted">找到 {{ house_list|length }} 个房源</p>
        </div>

        <div class="collection">
            <div id="fill-data" class="1">
                {% for house in house_list %}
                <div class="row collection-line">
                    <div class="col-lg-5 col-md-5">
                        <div>
                            <a href="/house/{{ house.id }}">
                                <img class="img-fluid img-box" src="/static/img/房源.jpg" alt="{{ house.title }}">
                            </a>
                        </div>
                    </div>
                    <div class="col-lg-5 col-md-5">
                        <div class="collection-line-info">
                            <div class="title">
                                <span>
                                    <a href="/house/{{ house.id }}">
                                        {{ house.title | dealover if house.title else house.address }}
                                    </a>
                                </span>
                            </div>
                            <div class="mb-2">
                                <span class="attribute-text">房源地址: </span>
                                <span class="info-text">{{ house.address }}</span>
                            </div>
                            <div class="mb-2">
                                <span class="attribute-text">建筑面积: </span>
                                <span class="info-text">{{ house.area }}平方米</span>
                            </div>
                            <div class="mb-2">
                                <span class="attribute-text">房源户型: </span>
                                <span class="info-text">{{ house.rooms }}</span>
                            </div>
                            <div class="mb-2">
                                <span class="attribute-text">房源朝向: </span>
                                <span class="info-text">{{ house.direction | dealdirection }}</span>
                            </div>
                            <div class="mb-2">
                                <span class="attribute-text">交通条件: </span>
                                <span class="info-text">{{ house.traffic | dealdirection }}</span>
                            </div>
                            <div class="mb-2">
                                <span class="attribute-text">
                                    <i class="fas fa-heart" style="color:#e74c3c"></i>
                                    {{ house.page_views if house.page_views else 0 }}人浏览过
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-2 col-md-2">
                        <div class="info-more">
                            <span class="price-text">¥{{ house.price }}</span>
                            <a href="/house/{{ house.id }}" class="btn btn-primary">
                                <i class="fas fa-arrow-right"></i> 查看详情
                            </a>
                        </div>
                    </div>
                </div>
                {% else %}
                <div class="text-center py-5">
                    <i class="fas fa-home fa-3x text-muted mb-3"></i>
                    <h4 class="text-muted">没有找到符合条件的房源</h4>
                    <p class="text-muted">请尝试其他搜索条件</p>
                    <a href="/" class="btn btn-primary">返回首页</a>
                </div>
                {% endfor %}
            </div>
        </div>
    </div>

    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>